package search;

/**
 * Created by IntelliJ IDEA.
 * User: 杰哥
 * Date: 2020/4/10
 * Time: 8:20
 */
public class SeqSearch {

    public static void main(String[] args) {
        String str = "646dadab偷cmuytds";
        System.out.println(str.indexOf("6"));
        System.out.println(str.indexOf(5077,1));
        System.out.println(str.indexOf("6", 1));
        System.out.println(str.indexOf("ds"));

    }

    public static int seqSearch(int[] arr, int value) {
        //线性查找是逐一比对，发现有相同值，就返回下标
        for (int i = 0; i < arr.length; i++) {
            if(arr[i] == value){
                return i;
            }
        }
        return -1;
    }

}
